﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>项点问题增加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../../../static/css/font.css">
    <link rel="stylesheet" href="../../../static/css/weadmin.css">
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
    <div class="weadmin-body">
        <form class="layui-form">
            <div class="layui-form-item">

                <label for="ProNo" class="layui-form-label" hidden="hidden">
                    <span class="we-red">*</span>项点编号
                </label>
                <div class="layui-input-inline" hidden="hidden">
                    <input type="text" id="ProNo" name="ProNo" lay-verify="required" en autocomplete="off" class="layui-input" readonly="readonly">
                </div>
                <label for="ProName" class="layui-form-label">
                    <span class="we-red">*</span>项点名称
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="ProName" name="ProName" lay-verify="required" autocomplete="off" class="layui-input" readonly="readonly">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="StartTime" class="layui-form-label">
                    问题发生时间
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="StartTime" name="StartTime" lay-verify="required" placeholder="  :  :  " lay-verify="regstarttime" autocomplete="off" class="layui-input">
                </div>

                <label for="QuestionValue" class="layui-form-label">
                    问题分值
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="QuestionValue" name="QuestionValue" lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="Question" class="layui-form-label">
                    项点试题
                </label>
                <div class="layui-input-block">
                    <textarea id="Question" name="Question" class="layui-textarea"></textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label for="OptionA" class="layui-form-label">
                    <span class="we-red">*</span>选项A、
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="OptionA" name="OptionA" lay-verify="required" autocomplete="off" class="layui-input">
                </div>

                <label for="OptionB" class="layui-form-label">
                    <span class="we-red">*</span>选项B、
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="OptionB" name="OptionB" lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="OptionC" class="layui-form-label">
                    <span class="we-red">*</span>选项C、
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="OptionC" name="OptionC" lay-verify="required" autocomplete="off" class="layui-input">
                </div>

                <label for="OptionD" class="layui-form-label">
                    <span class="we-red">*</span>选项D、
                </label>
                <div class="layui-input-inline">
                    <input type="text" id="OptionD" name="OptionD" lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="RightAnswer" class="layui-form-label">
                    <span class="we-red"></span>正确答案
                </label>
                <div class="layui-input-inline">
                    <select id="RightAnswer" name="RightAnswer" autocomplete="off" class="valid" >
                        <option value=""></option>
                        <option value="A">A</option>
                        <option value="B">B</option>
                        <option value="C">C</option>
                        <option value="D">D</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit="" lay-filter="add">确定</button>
                </div>
            </div>

        </form>
    </div>
    <script src="../../../lib/layui/layui.js" charset="utf-8"></script>
    <script src="../../../static/js/common.js" charset="utf-8"></script>
    <script>
        layui.use(['form', 'jquery', 'layer', 'laydate', 'upload'], function () {
            var form = layui.form,
                $ = layui.jquery,
                layer = layui.layer;
            $.support.cors = true;
            $.ajaxSetup({
                cache: false,
                headers: {
                    "userid": JSON.parse(window.localStorage.authInfo).UserId,
                    "signtoken": JSON.parse(window.localStorage.authInfo).SignToken,
                },
            })
            form.verify({
                regstarttime: ['^\d\d:\d\d:\d\d']
            });
            var prono = getUrlParam("ProNo");
            var proname = getUrlParam("ProName");
            $("#ProName").val(proname);
            $("#ProNo").val(prono);

            //监听提交
            form.on('submit(add)', function (formdata) {
                $.ajax({
                    url: ApiUrl + "ProjectQuestion/Add",
                    type: 'post',
                    dataType: 'json',
                    data: formdata.field,
                    success: function (data) {
                        if (data.StatusCode == 200 && data.Count != 0) {
                            layer.alert(data.Info, { icon: 6 }, function (index) {
                                parent.layer.closeAll();
                            })
                        }
                        else if (data.StatusCode == 403) {
                            top.layer.alert(data.Info + ",请重新登录！", { closeBtn: 0 }, function () {
                                top.location.href = "http://" + top.location.host + "/login.html";
                            })
                        }
                        else {
                            layer.msg(data.Info);
                        }
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>